

import 'package:flutter_ncsjqz_getx/api/api.dart';
import 'package:flutter_ncsjqz_getx/generated/json/base/json_convert_content.dart';
import 'dio_util.dart';
/// <summary>
/// author：zwb
/// dateTime： 2021/12/16 09:50
/// filePath： lib/http/dio_service.dart
/// desc: service
/// <summary>
///
class  DioService<T>{
  T?  model;
  /// 验证码 1注册，2登录，3找回密码
  getSmsCode(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.getSmsCode,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 登录
  login(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.login,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 退出登录
  loginOut() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.loginOut);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 注册
  checkAndRegister(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.checkAndRegister,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 查找协议
  protocol(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.protocol,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }


  /// 找回密码
  retrievePwd(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.retrievePwd,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 查询个人信息-详情
  queryPersonalDetail() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.queryPersonalDetail,params: {});
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 更新个人信息
  updateUserInfo(Map<String,dynamic> data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.updateUserInfo,data:data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }


  /// 用户列表
  friendList() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.friendList,);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 查询用户头像昵称是否免打扰
  queryUserRemarkList(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.queryUserRemarkList,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 查询好友信息
  queryFriendInfo(friendId) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.queryFriendInfo,params: {"friendId":friendId});
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 查询好友信息
  queryUserDetail(int friendId,String remarkName) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.queryUserDetail,params: {"friendId":friendId,"remarkName": remarkName});
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 设置好友备注+免打扰
  updateRemark(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.updateRemark,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 我的帖子(历史发布)分页列表
  userPage(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.userPage,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 发布帖子
  releasePost(Map<String,dynamic> data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.releasePost,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 删除帖子
  delPost(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.delPost,data: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }


  /// 我的关注、粉丝数
  followAndFansCount() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.followAndFansCount,params: {});
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 我的关注、粉丝详情分页列表
  followAndFansPage(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.followAndFansPage,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }


  /// 圈子首页分类类型
  postCategory() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.postCategory,params: {});
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 帖子首页分页（条件搜索）列表
  indexPage(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.indexPage,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 帖子首页广告轮播图
  advertisingCarousel() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.advertisingCarousel,);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 帖子帖子点赞、取消点赞
  praise(Map<String,dynamic> data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.praise,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 用户评论帖子
  publishComment(Map<String,dynamic> data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.publishComment,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 用户回复帖子
  publishReply(Map<String,dynamic> data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.publishReply,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 点击关注
  clickFollow(Map<String,dynamic> data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.clickFollow,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 取消关注
  cancelFollow(Map<String,dynamic> data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.cancelFollow,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 我的钱包详情
  walletDetail() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.walletDetail,);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 我的钱包充值
  recharge(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.recharge,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }


  /// 我的账户记录（收入、支出）分页列表
  accountRecordPage(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.accountRecordPage,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 帖子详情
  postDetail(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.postDetail,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 投诉举报帖子
  complaint(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.complaint,data: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 获取七牛授权token
  get7AccessToken() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.get7AccessToken,params: {});
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 商城首页轮播图
  queryCarouselList() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.queryCarouselList,params: {});
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// （商品首页搜索、类型搜索、默认搜索）分词搜索
  indexSearch(Map<String,dynamic> params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.indexSearch,params:params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 商城首页分类类型
  commodityCategory() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.commodityCategory,);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 商品详情
  commodityDetail(Map<String,dynamic> params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.commodityDetail,params:params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 订单提交
  submitOrder(dynamic data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.submitOrder,data:data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 订单取消
  userCancelOrder(dynamic data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.userCancelOrder,data:data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 退订单详情
  queryOrderRefundDetail(dynamic data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.queryOrderRefundDetail,params:data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 申请退款
  applyOrderRefund(dynamic data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.applyOrderRefund,data:data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 获取电子签名
  getSignature(Map<String,dynamic> params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.getSignature,params:params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 提交电子签名
  submitSignature(Map<String,dynamic> params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.submitSignature,data:params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 确认支付-返回签名信息
  payOrder(Map<String,dynamic> params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.payOrder,data:params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 查询系统公告
  v2_listSysNotice() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.v2_listSysNotice,params: {});
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 查询系统公告详情
  v2_sysNoticeDetail(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.v2_sysNoticeDetail,params:params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 更改消息状态（已读未读）
  changeMessageStatus(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.changeMessageStatus,data:data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 统计消息未读数
  statisticsMsgCount() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.statisticsMsgCount);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 用户平台消息、公告消息、互动消息、分页列表
  messagePage(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.messagePage,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 添加群
  createGroup(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.createGroup,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 加入群
  joinGroup(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.joinGroup,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }


  /// 获取群信息
  getGroup(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.getGroup,params: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 设置群聊信息
  updateGroup_v2(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.updateGroup_v2,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 退出群聊
  quitGroup(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.quitGroup,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 解散群聊
  dismissGroup(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.dismissGroup,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 获取好友申请列表
  Future<T?> friendApplyList() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.friendApplyList,);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }


  /// 发起好友申请
  friendApply(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.friendApply,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 同意或拒绝好友
  friendApplyOperate(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.friendApplyOperate,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 查找朋友（根据手机号查找）
  findFriend(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.findFriend,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 平台客服
  platformCustomerService() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.platformCustomerService,);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 融云token
  rongGetToken() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.rongGetToken,);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 发送邮箱验证码
  getMailboxSmsCode(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.getMailboxSmsCode,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 发送邮箱验证码
  bindMailbox(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.bindMailbox,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 获取隔离信息
  queryIsolationInfo() async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.queryIsolationInfo,);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 获取隔离信息
  setBlacklist(data) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.post<T>(Api.setBlacklist,data: data);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 获取订单列表
  listOrderStatus(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.listOrderStatus,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 获取所有监控
  getVideoSurveillance(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.getVideoSurveillance,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 获取我的监控
  getMyVideoSurveillance(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.getMyVideoSurveillance,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 获取我的监控
  getVideoClass(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.getVideoClass,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

  /// 获取我的监控
  getVideoSurveillance1(params) async{
    Map<String, dynamic>? map =  await DioUtil.getInstance().httpUtil.get<T>(Api.getVideoSurveillance,params: params);
    model = JsonConvert.fromJsonAsT<T>(map);
    return model;
  }

}